package com.ct.web.controllers.ajax;

import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Logger;
import org.springframework.web.servlet.view.AbstractView;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: Admin
 * Date: 20.12.2009
 * Time: 17:19:56
 * To change this template use File | Settings | File Templates.
 */
public class AjaxView extends AbstractView {

    private static Logger LOG = Logger.getLogger(AjaxView.class);

    private String key;

    public AjaxView(String key){
        this.key = key;
    }

    @Override
    protected void renderMergedOutputModel(Map map, HttpServletRequest req,
        HttpServletResponse resp) throws Exception {

        String responseStr = (String)map.get(key);        
        resp.setContentType("text/plain; charset=UTF-8");
        resp.getOutputStream().write(responseStr.getBytes());
    }


}